package com.sql.model;

import org.hibernate.validator.constraints.Email;

import javax.validation.constraints.Size;

/**
 * Created by 走过全世界。 on 2017/5/30 0030.
 */
public class User {
    private Integer id;


    //用户名
    private String username;

    //密码（MD5）
    private String password;

    //身份证号
    @Size(max = 18, min = 18, message = "错误的身份证号格式")
    private String id_number;

    //邮箱
    @Email(message = "错误的邮箱地址")
    private String email;

    //联系方式
    private String phone;

    //权限  1为管理员，0为普通用户
    private Integer permission;

    public void setId(Integer id) {
        this.id = id;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public void setId_number(String id_number) {
        this.id_number = id_number;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    public void setPhone(String phone) {
        this.phone = phone;
    }

    public void setPermission(Integer permission) {
        this.permission = permission;
    }


    public Integer getId() {
        return id;
    }

    public String getUsername() {
        return username;
    }

    public String getPassword() {
        return password;
    }

    public String getId_number() {
        return id_number;
    }

    public String getEmail() {
        return email;
    }

    public String getPhone() {
        return phone;
    }

    public Integer getPermission() {
        return permission;
    }

    public User(Integer id, String username, String password, String id_number,
                String email, String phone, Integer permission) {
        this.id = id;
        this.username = username;
        this.password = password;
        this.id_number = id_number;
        this.email = email;
        this.phone = phone;
        this.permission = permission;
    }

    @Override
    public String toString() {
        return "User{" +
                "id=" + id +
                ", username='" + username + '\'' +
                ", password='" + password + '\'' +
                ", id_number='" + id_number + '\'' +
                ", email='" + email + '\'' +
                ", phone='" + phone + '\'' +
                ", permission=" + permission +
                '}';
    }

    public User() {

    }

}